package com.learn.design.dip;

public class Driver implements IDriver {

    private ICar car;

    //构造函数注入
    public Driver(ICar car) {
        this.car = car;
    }

    /**
     * 司机的主要职责就是驾驶汽车
     *
     * @param car
     */
//    @Override
//    public void drive(ICar car) {
//        car.run();
//    }

    @Override
    public void drive() {
        car.run();
    }
}
